home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
vbkontrol.exe
/
FSSOCK11.ZIP
/
demo
/
fstest
/
SERVER.FRM
< prev
next >
Wrap
Text File
|
1995-07-15
|
12KB
|
446 lines
VERSION 2.00
Begin Form Server
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Server Test"
ClientHeight = 6915
ClientLeft = 7860
ClientTop = 1620
ClientWidth = 6960
ControlBox = 0 'False
Height = 7320
Icon = SERVER.FRX:0000
Left = 7800
LinkTopic = "Form1"
ScaleHeight = 6915
ScaleWidth = 6960
Top = 1275
Width = 7080
Begin TextBox Text2
Height = 285
Left = 120
TabIndex = 25
Text = "Text2"
Top = 6360
Width = 855
End
Begin TextBox Text1
Height = 285
Left = 120
TabIndex = 24
Text = "Text1"
Top = 6000
Width = 855
End
Begin TextBox HSTNAME
Height = 285
Left = 120
TabIndex = 22
Text = "Text1"
Top = 2040
Width = 2175
End
Begin CommandButton Connect
Caption = "Connect"
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 21
Top = 6000
Width = 1215
End
Begin TextBox localaddress
Height = 285
Left = 120
TabIndex = 18
Top = 3840
Width = 2175
End
Begin TextBox localport
Height = 285
Left = 120
TabIndex = 17
Top = 4440
Width = 2175
End
Begin FSSocket FSSocket1
Connect = 0 'False
EOL = ""
HostAddress = ""
HostName = ""
InputBufferSize = 4096
Left = 1920
Listen = 0 'False
ListenPort = 0
OutputBufferSize= 4096
PortNumber = 0
Protocol = 0 'TCP
ServiceName = ""
Top = 960
End
Begin CommandButton StopListenButt
Caption = "Stop Listen"
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 16
Top = 5640
Width = 1215
End
Begin CheckBox ListenMark
BackColor = &H00C0C0C0&
Caption = "Listening"
Height = 255
Left = 120
TabIndex = 15
Top = 4920
Width = 1215
End
Begin TextBox LPText
Height = 285
Left = 120
TabIndex = 3
Text = "Text1"
Top = 5640
Width = 855
End
Begin CommandButton DisconnButt
Caption = "Disconnect"
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 5
Top = 6360
Width = 1215
End
Begin TextBox INDATA
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Courier New"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 6375
Left = 2400
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 10
TabStop = 0 'False
Text = "Text1"
Top = 0
Width = 4575
End
Begin TextBox OUTDATA
Height = 285
Left = 3120
TabIndex = 6
Text = "Text2"
Top = 6480
Width = 3735
End
Begin CommandButton ListenButt
Caption = "Listen"
Height = 375
Left = 1080
TabIndex = 4
Top = 5280
Width = 1215
End
Begin OptionButton UDP
BackColor = &H00C0C0C0&
Caption = "UDP"
Height = 255
Left = 120
TabIndex = 9
Top = 1320
Width = 1095
End
Begin OptionButton TCP
BackColor = &H00C0C0C0&
Caption = "TCP"
Height = 255
Left = 120
TabIndex = 1
Top = 960
Value = -1 'True
Width = 1095
End
Begin TextBox HSTADDR
Height = 285
Left = 120
TabIndex = 8
TabStop = 0 'False
Text = "Text4"
Top = 2640
Width = 2175
End
Begin TextBox PORTNUM
Height = 285
Left = 120
TabIndex = 2
TabStop = 0 'False
Text = "Text5"
Top = 3240
Width = 2175
End
Begin CheckBox CNTD
BackColor = &H00C0C0C0&
Caption = "Connected"
Height = 255
Left = 120
TabIndex = 7
TabStop = 0 'False
Top = 480
Width = 1455
End
Begin CheckBox RDYTOSND
BackColor = &H00C0C0C0&
Caption = "Ready to Send"
Height = 255
Left = 120
TabIndex = 0
TabStop = 0 'False
Top = 120
Width = 1695
End
Begin Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Remote Name"
Height = 195
Left = 120
TabIndex = 23
Top = 1800
Width = 1200
End
Begin Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Local Address"
Height = 195
Left = 120
TabIndex = 20
Top = 3600
Width = 1215
End
Begin Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Local Port"
Height = 195
Left = 120
TabIndex = 19
Top = 4200
Width = 885
End
Begin Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Port"
Height = 195
Left = 120
TabIndex = 13
Top = 5400
Width = 360
End
Begin Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Input:"
Height = 255
Left = 2520
TabIndex = 14
Top = 6480
Width = 510
End
Begin Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Remote Address"
Height = 195
Left = 120
TabIndex = 12
Top = 2400
Width = 1395
End
Begin Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Remote Port"
Height = 195
Left = 120
TabIndex = 11
Top = 3000
Width = 1065
End
Begin Line Line2
X1 = 2400
X2 = 0
Y1 = 840
Y2 = 840
End
Begin Line Line1
X1 = 2400
X2 = 2400
Y1 = 0
Y2 = 6960
End
End
Sub Connect_Click ()
On Error GoTo errz
FSSocket1.ListenPort = LPText.Text
FSSocket1.Connect = True
LocalAddress.Text = FSSocket1.LocalAddress
LocalPort.Text = FSSocket1.LocalPort
StopListenButt.Enabled = False
ListenButt.Enabled = False
DisconnButt.Enabled = True
Exit Sub
errz:
MsgBox FSSocket1.WSALastErrorMsg
Resume Next
End Sub
Sub DisconnButt_Click ()
FSSocket1.Connect = False
End Sub
Sub Form_Load ()
Show
FSSocket1.EOL = Chr$(10)
INDATA.Text = ""
OUTDATA.Text = ""
HSTADDR.Text = FSSocket1.HostAddress
HSTNAME.Text = FSSocket1.HostName
PORTNUM.Text = FSSocket1.PortNumber
LPText.Text = FSSocket1.ListenPort
If FSSocket1.Protocol = 0 Then
TCP.Value = True
Else
UDP.Value = True
End If
End Sub
Sub FSSocket1_Connected (StatusCode As Integer, Description As String)
CNTD.Value = 1
RDYTOSND.Value = 1
PORTNUM.Text = FSSocket1.PortNumber
HSTADDR.Text = FSSocket1.HostAddress
HSTNAME.Text = FSSocket1.HostName
LocalAddress.Text = FSSocket1.LocalAddress
LocalPort.Text = FSSocket1.LocalPort
ListenMark.Value = 0
DisconnButt.Enabled = True
StopListenButt.Enabled = False
End Sub
Sub FSSocket1_DataReceived (Text As String, EOL As Integer)
HSTADDR.Text = FSSocket1.HostAddress
PORTNUM.Text = FSSocket1.PortNumber
INDATA.SelStart = 32000
INDATA.SelText = Text
If EOL Then
INDATA.SelStart = 32000
INDATA.SelText = Chr$(13) & Chr$(10)
End If
End Sub
Sub FSSocket1_Disconnected (StatusCode As Integer, Description As String)
LocalAddress.Text = ""
LocalPort.Text = ""
CNTD.Value = 0
RDYTOSND.Value = 0
PORTNUM.Text = ""
HSTADDR.Text = ""
HSTNAME.Text = ""
If FSSocket1.Listen = False Then
ListenMark.Value = 0
StopListenButt.Enabled = False
Else
ListenMark.Value = 1
StopListenButt.Enabled = True
End If
DisconnButt.Enabled = False
End Sub
Sub FSSocket1_ReadyToSend ()
RDYTOSND.Value = 1
End Sub
Sub ListenButt_Click ()
On Error GoTo errx
FSSocket1.ListenPort = LPText.Text
FSSocket1.Listen = True
LPText.Text = FSSocket1.ListenPort
text1.Text = FSSocket1.ListenPort \ 256
text2.Text = FSSocket1.ListenPort Mod 256
StopListenButt.Enabled = True
ListenButt.Enabled = False
DisconnButt.Enabled = False
If FSSocket1.Listen = False Then
ListenMark.Value = 0
Else
ListenMark.Value = 1
End If
Exit Sub
errx:
MsgBox "Error number " & Err & " occurred at line " & Erl
MsgBox FSSocket1.WSALastErrorMsg
Resume Next
End Sub
Sub OUTDATA_KeyPress (keyascii As Integer)
If keyascii = 13 Then
If FSSocket1.Connect = True Then
RDYTOSND.Value = 0
FSSocket1.Send = OUTDATA.Text & Chr$(10)
End If
OUTDATA.Text = ""
keyascii = 0
End If
End Sub
Sub StopListenButt_Click ()
FSSocket1.Listen = False
If FSSocket1.Listen = False Then
ListenMark.Value = 0
Else
ListenMark.Value = 1
End If
ListenButt.Enabled = True
StopListenButt.Enabled = False
DisconnButt.Enabled = False
End Sub
Sub TCP_Click ()
FSSocket1.Protocol = 0
ListenButt.Enabled = True
StopListenButt.Enabled = False
Connect.Enabled = False
End Sub
Sub UDP_Click ()
FSSocket1.Protocol = 1
'ListenButt.Enabled = False
'StopListenButt.Enabled = False
Connect.Enabled = True
End Sub